﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.HTML
{
    #region Using Statements

    using System;

    #endregion

    /// <summary>
    /// This contains generic meta-information about the document. See the 
    /// META element definition in HTML 4.01.
    /// </summary>
    public class HTMLMetaElement : HTMLElement
    {
        #region Constructors

        internal HTMLMetaElement(Document owner)
            : base(owner, "meta")
        {
        }

        #endregion

        #region DOM Level 2 HTML Compliance

        /// <summary>
        /// Associated information. See the content attribute definition 
        /// in HTML 4.01.
        /// </summary>
        public string content
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_CONTENT);
            }
            set
            {
                setAttribute(HTMLConstants.HTML_ATT_CONTENT, value);
            }
        }

        /// <summary>
        /// HTTP response header name [IETF RFC 2616]. See the http-equiv 
        /// attribute definition in HTML 4.01.
        /// </summary>
        public string httpEquiv
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_HTTPEQUIV);
            }
            set
            {
                setAttribute(HTMLConstants.HTML_ATT_HTTPEQUIV, value);
            }
        }

        /// <summary>
        /// Meta information name. See the name attribute definition 
        /// in HTML 4.01.
        /// </summary>
        public string name
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_NAME);
            }
            set
            {
                setAttribute(HTMLConstants.HTML_ATT_NAME, value);
            }
        }

        /// <summary>
        /// Select form of content. See the scheme attribute definition 
        /// in HTML 4.01.
        /// </summary>
        public string scheme
        {
            get
            {
                return getAttribute(HTMLConstants.HTML_ATT_SCHEME);
            }
            set
            {
                setAttribute(HTMLConstants.HTML_ATT_SCHEME, value);
            }
        }

        #endregion

        #region Methods

        public override string ToString()
        {
            return String.Format("META[{0}]", 
                String.IsNullOrEmpty(name) ? httpEquiv : name);
        }

        #endregion
    }
}
